# Copyright 2010 Michael Bruno
#
# This file is part of AYACE
#
# AYACE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# at your option) any later version.
#
# AYACE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with AYACE.  If not, see <http://www.gnu.org/licenses/>.
#


TARGET = chess

CC = gcc
CFLAGS = -O3 -std=gnu99 -Wall -march=native
LIBS = -lpthread
LDFLAGS = $(LIBS)

SOURCES := . bitboard
CFILES := $(foreach dir, $(SOURCES), $(wildcard $(dir)/*.c))

OBJS = $(patsubst %.c,%.o,$(CFILES))

all: $(TARGET)

play: $(TARGET)
	xboard -debug -size medium -fcp ./$(TARGET)

playics: $(TARGET)
	xboard -zp -zippyAcceptOnly mattbruno -ics -icshost freechess.org -debug -size medium -fcp ./$(TARGET)

playself: $(TARGET)
	xboard -debug -size medium -fcp ./$(TARGET) -scp ./$(TARGET)

playgnu: $(TARGET)
	xboard -debug -size medium -scp ./$(TARGET) -fcp gnuchessx

playtoledo: $(TARGET)
	xboard -debug -size medium -fcp ./$(TARGET) -scp ./toledo

clean:
	rm -f $(OBJS) $(TARGET)

$(TARGET): $(OBJS)
	$(CC) $(LDFLAGS) $(OBJS) -o $@

%.o: %.c
	$(CC) -c $(CFLAGS) $< -o $@
	
	

